﻿{extend name="common/inside"}

{block name="table"}
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="r">共有数据：<strong>88</strong> 条</span>
    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th>序号</th>
                <th>发布者</th>
                <th>信息</th>
                <th>用户体</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach $messages as $message}
            <tr class="text-c">
                <td>{$message->message_id}</td>
                <td>{$message->isCheckType()}</td>
                <td>{$message->message_content}</td>
                <td>{$message->uid}</td>
                <td>{$message->created_at}</td>
                <td class="td-manage">
                    <a href="javascript:;"
                       onclick="member_add('查看用户','{:str_replace('id',$message->uid,url('/message/id'))}',  , 600)">查看用户</a>
                    <a href="javascript:;" onclick="check(this,{$message->message_id},2,{$message->uid})">批准</a>
                    <a href="javascript:;" onclick="check(this,{$message->message_id},1,{$message->uid})">驳回</a>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
</div>

{/block}


{block name='js'}
<script>

    function check(obj, id, state, uid) {

        var str = state == 2 ? '是否批准?' : '是否驳回?'

        layer.confirm(str, function (index) {

            var url = "{:url('/admin/message/check')}"
            $.post(url, {
                message_id: id,
                state: state,
                uid: uid
            }, function (data) {

            }, 'json')
        });
    }


</script>

{/block}


{extend name="common/inside"}

{block name="nav"}
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span>
    用户管理
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
{/block}


{block name="table"}
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="r">共有数据：<strong>88</strong> 条</span>
    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th>序号</th>
                <th>发布者</th>
                <th>信息</th>
                <th>用户体</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach $messages as $message}
            <tr class="text-c">
                <td>{$message->message_id}</td>
                <td>{$message->isCheckType()}</td>
                <td>{$message->message_content}</td>
                <td>{$message->uid}</td>
                <td>{$message->created_at}</td>
                <td class="td-manage">
                    {if $message->message_state == 0}
                    <a href="javascript:;"
                       onclick="member_add('查看用户','{:str_replace('id',$message->uid,url('/message/id'))}')">查看用户</a>
                    <a href="javascript:;" onclick="check(this,{$message->message_id},2,{$message->uid})">批准</a>
                    <a href="javascript:;" onclick="check(this,{$message->message_id},1,{$message->uid})">驳回</a>
                    {elseif $message->message_state == 1}
                        <font color="red">已驳回</font>
                    {elseif $message->message_state == 2}
                        <font color="green">已批准</font>
                    {/if}
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
</div>

{/block}


{block name='js'}
<script>

    function check(obj, id, state, uid) {

        var str = state == 2 ? '是否批准?' : '是否驳回?'

        layer.confirm(str, function (index) {

            var url = "{:url('/admin/message/check')}"
            $.post(url, {
                message_id: id,
                state: state,
                uid: uid
            }, function (data) {
                if (data.state == 'success') {
                    alert(data.msg)
                }

                window.location.reload()
            }, 'json')
        });
    }


</script>

{/block}




